# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-esmre
pkgname=('python2-esmre' 'python-esmre')
_pkgname=esmre
pkgver=1.0.1
pkgrel=3
pkgdesc='Modules used to accelerate execution of a large collection of regular expressions using the Aho-Corasick algorithms.'
arch=('x86_64' 'aarch64')
url='https://pypi.org/project/esmre/#files'
license=('LGPL')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('87a21dcaeecbea4bbde412460ed58d6c9168c62af48fee5676273223039e4cc06cccdfba056608edf7111d9ab65e618a4f6013670cfd1edda05a9450c4c0ea44')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-esmre() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

package_python-esmre() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

